{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "the rosdep view is empty: call 'sudo rosdep init' and 'rosdep update'\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[INFO] [1634200969.751835]: 等待move_base action服务器连接...\n",
      "[INFO] [1634200970.006495]: 已连接导航服务\n",
      "[INFO] [1634200970.008171]: 已连接机械臂控制服务\n",
      "[INFO] [1634200982.334389]: 尝试导航去坐标点:(2,0,-180)\n",
      "[INFO] [1634200997.335572]: 时间超时，导航任务取消。\n",
      "[INFO] [1634200997.336134]: 尝试播放本地音频\n",
      "[INFO] [1634200997.372181]: 本地播放失败，尝试在线合成，请确认网络\n",
      "[INFO] [1634200999.238522]: 尝试导航去坐标点:(0,0,0)\n",
      "[INFO] [1634201014.240183]: 时间超时，导航任务取消。\n",
      "[INFO] [1634201014.255460]: 请开始说话...\n",
      "[INFO] [1634201020.409851]: 语音识别结果为：\n",
      "[INFO] [1634201020.410438]: 西安天气。\n",
      "[INFO] [1634201020.410854]: 向图灵机器人发送问题...\n",
      "[INFO] [1634201020.788487]: 从图灵获得答案：\n",
      "[INFO] [1634201020.789097]: 西安:周四 10月14日,小雨转阴 西南风,最低气温11度，最高气温16度。\n",
      "[INFO] [1634201020.789724]: 开始语音合成：\n",
      "[INFO] [1634201020.790116]: 西安:周四 10月14日,小雨转阴 西南风,最低气温11度，最高气温16度。\n",
      "[INFO] [1634201020.790637]: 开始识别......\n",
      "[INFO] [1634201030.791948]: 开始语音合成：\n",
      "[INFO] [1634201030.792479]: 识别结果为：\n",
      "[INFO] [1634201030.796511]: 开始语音合成：\n",
      "[INFO] [1634201030.796978]: None\n",
      "[INFO] [1634201030.797409]: 尝试播放本地音频\n"
     ]
    }
   ],
   "source": [
    "#!/usr/bin/env python\n",
    "#coding=utf-8\n",
    "import rospy\n",
    "import cv2\n",
    "from aikit_lib import aikit_2wd\n",
    "aikit=aikit_2wd.robot()             \n",
    "# aikit.speak(\"左右转动测试\") \n",
    "aikit.turn(0.3,3) \n",
    "aikit.turn(-0.3,3)\n",
    "# aikit.speak(\"前后运动测试\") \n",
    "aikit.go(0.3,3) \n",
    "aikit.go(-0.3,3) \n",
    "# 开始导航\n",
    "aikit.nav_to(2,0,-180) \n",
    "aikit.play_sound(\"导航回原点\")\n",
    "aikit.nav_to(0,0,0) \n",
    "#机械臂控制，夹子闭合   \n",
    "aikit.set_claw(0)\n",
    "#机械臂控制，夹子张开\n",
    "aikit.set_claw(90)\n",
    "#语音识别\n",
    "question=aikit.listen()\n",
    "#图灵问答\n",
    "answer=aikit.tuling(question)\n",
    "#语音合成\n",
    "aikit.speak(answer)\n",
    "#图像识别\n",
    "label=aikit.object_label()\n",
    "aikit.speak(\"识别结果为：\")  \n",
    "aikit.speak(label)  \n",
    "#播放本地语音\n",
    "aikit.play_sound(\"张三李四王五678910dfghjkl\")\n",
    "#获取摄像头画面\n",
    "frame=aikit.read_camera()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
